package com.isprint.jslx.lcc.mysq;

import com.jfinal.kit.Prop;
import com.jfinal.kit.PropKit;
import com.jfinal.plugin.druid.DruidPlugin;

/**
 * Created by ydw on 2017/7/14.
 */
public class MysqlProperties {
//    private static Prop mysql = PropKit.use("config/mysql.properties");
private static Prop mysql = PropKit.use("config/mac_mysql.properties");
    /**
     * 数据库连接URL,数据库用户名，数据库密码，驱动
     */
    public static String JDBC_URL=mysql.get("jdbcUrl");
    public static String JDBC_USERNAME=mysql.get("user");
    public static String JDBC_PASSWORD=mysql.get("password");
    public static String JDBC_DRIVER=mysql.get("driver");
    public static Integer minIdel=mysql.getInt("minIdel");
    public static Integer maxSize=mysql.getInt("maxSize");
    public static DruidPlugin getdruidPlugin(){
//        DruidPlugin(String url, String username, String password, String driverClass) {
        DruidPlugin druidPlugin = new DruidPlugin(JDBC_URL, JDBC_USERNAME, JDBC_PASSWORD,JDBC_DRIVER);
        druidPlugin.setMinIdle(minIdel);
        druidPlugin.setMaxPoolPreparedStatementPerConnectionSize(maxSize);
        return druidPlugin;
    }
}
